<template>
    <div>
        <van-nav-bar id="reset" :title="topicType == 2 ? '视频列表' : '文章列表'" left-arrow @click-left="backHandle" fixed
            z-index="100" />
        <div class="pageCon fuPage">
            <div class="videoBox">
                <template v-if="videoList.length != 0">
                    <div class="video" v-for="(item, index) in videoList" :key="index" @click="toDetail(item)">
                        <img :src="item.topicPic">
                        <div>
                            <div>{{ item.topicTitle }}</div>
                            <div>{{ item.categoryName }}</div>
                            <div>
                                <img src="../../assets/index/userTip.png" alt="">
                                <div>{{ item.doctorName }}</div>
                            </div>
                        </div>
                    </div>
                </template>
                <div class="emptyBox" v-else>
                    <img src="../../assets/tip_content.png">
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import { imgUrl } from '../../network/request'
import { listMoreTopic } from '../../network/content'

export default {
    name: 'HomeR',
    data() {
        return {
            imgUrl,
            videoList: [],
            topicType: 1
        }
    },
    mounted() {

    },
    methods: {

        getList() {
            listMoreTopic({
                doctorId: 0,
                topicType: this.topicType == 2 ? 1 : 0
            }).then(res => {
                if (res.flag) {
                    res.data = res.data.sort((a, b) => {
                        return b.orderNum - a.orderNum
                    })
                    res.data = res.data.sort((a, b) => {
                        return b.zhiding - a.zhiding
                    })

                    this.videoList = res.data
                }
            })
        },

        toDetail(obj) {
            console.log(obj);
            //  视频 论坛详情
            this.$router.push({
                path: "/topicDetail",
                query: {
                    flag: this.topicType,
                    content: obj
                },
            });
            console.log(obj);
        },
        backHandle() {
            this.$router.back()
        },

    },
    created() {
        console.log(this.$router);
        console.log(this.$router.history.current.query);
        this.topicType = this.$router.history.current.query.flag
        this.getList()
    },
    //计算属性
    computed: {

    },
    filters: {

    }

}

</script>

<style lang='less' scoped>
.pageCon {
    box-sizing: border-box;
    position: relative;
    width: 100%;
    height: 100vh;
    // background-color: #EEF1F7;
    overflow-y: scroll;
}


#reset /deep/ .van-nav-bar__left .van-nav-bar__text,
#reset /deep/ .van-nav-bar__left .van-icon {
    color: #333 !important;
}


.video {
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    width: 100%;
}

.video>img {
    margin-right: 14px;
    // width: 330px;
    width: 46%;
    height: 186px;
    // background: #eee;
    border-radius: 8px;
}

.video>div {
    position: relative;
    flex: 1;
    height: 186px;
}

.video>div>div:first-child {
    width: 360px;
    font-weight: 400;
    font-size: 28px;
    color: #333333;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video>div>div:nth-child(2) {
    margin-top: 14px;
    font-weight: 400;
    font-size: 24px;
    color: #858B90;
}

.video>div>div:nth-child(3) {
    position: absolute;
    bottom: 0px;
    width: 100%;
    display: flex;
    align-items: center;
    // justify-content: space-between;
    font-weight: 400;
    font-size: 20px;
    color: #858B90;
}

.video>div>div:nth-child(3)>img {
    margin-right: 10px;
    width: 24px;
    height: 24px;
}

.clockBox,
.videIcon {
    display: flex;
    align-items: center;
}

.clockBox>img {
    margin-right: 12px;
    width: 20px;
    height: 20px;
}

.videIcon>img {
    margin-right: 12px;
    width: 28px;
    height: 20px;
}

.videoBox {
    box-sizing: border-box;
    width: 100%;
    padding: 20px;
}

.emptyBox {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100vh;
}

.emptyBox>img {
    width: 374px;
    height: 314px;
}
</style>